package hku.cs.lunuo.voter.impl;

import hku.cs.lunuo.rank.DefaultLabel;
import hku.cs.lunuo.rank.model.Label;
import hku.cs.lunuo.voter.VotedGlobal;
import hku.cs.lunuo.voter.VotedUnit;
import hku.cs.lunuo.voter.Voter;

public class JMinosT extends Voter {

	@Override
	public Label vote(VotedUnit u, VotedGlobal g) {
		int falseCases = u.tf.getFlsTimes();
		int trueCases = u.tf.getTruTimes();
		float susc, noise;
		
		if (g.totalTF.getFlsTimes() == 0 && trueCases == 0)
			susc = 0;
		else
			susc = (float) falseCases / (g.totalTF.getFlsTimes() + trueCases);
		
		noise = (float) trueCases/(g.totalTF.getTruTimes() + falseCases);
		
		return new DefaultLabel(susc-noise);
	}
	
}
